<template>
  <div id="app">
    <van-button type="default">默认按钮</van-button>
    <van-button type="primary">主要按钮</van-button>
    <van-button type="info">信息按钮</van-button>
    <van-button type="warning">警告按钮</van-button>
    <van-button type="danger">危险按钮</van-button>
    <uni-popup-captcha ref="popup-captcha" @confirm="verifyCaptcha" :scene="formData.scene" v-model="formData.captcha"></uni-popup-captcha>
    <button @click="openPopupCaptcha">显示弹出式验证码</button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formData: {
        captcha: '',
        scene: 'test'
      }
    };
  },
  methods: {
    verifyCaptcha() {
      const uniCaptchaDemoCo = uniCloud.importObject('uni-captcha-demo');
      uniCaptchaDemoCo.verify(this.formData).then((e) => {
        uni.showToast({
          title: e.errMsg,
          icon: 'none'
        });
      });
    },
    openPopupCaptcha() {
      this.$refs['popup-captcha'].open();
    }
  }
};
</script>